package com.roncoo.course.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roncoo.course.entity.EduCourse;
import com.roncoo.course.entity.EduSubject;
import com.roncoo.course.service.EduCourseService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wdf
 * @since 2021-03-26
 */
@RestController
@RequestMapping("/eduCourse")
public class EduCourseController {
    @Resource
    private EduCourseService eduCourseService;



    /*
        1.更改课程状态
     */
    @ApiOperation(value = "更改课程信息 ")
    @PostMapping("update")
    public Boolean addCourseByFq(EduCourse eduCourse) {
        return this.eduCourseService.updateById(eduCourse);
    }
    /*
        查找所有的课程
     */
    @ApiOperation(value = "查询所有的课程 ")
    @RequestMapping("selectAll")
    public IPage<EduCourse> selectALl(Page page, EduCourse eduCourse) {
//        QueryWrapper<EduCourse> advQueryWrapper = new QueryWrapper<>();
//        advQueryWrapper.eq("zhuanquid",id);
        return this.eduCourseService.findAll(page, eduCourse);
    }
}

